#!/usr/local/bin/python

import sys

fh = open(sys.argv[1], 'r')
batch_size = 6180
f_cnt = 10001
sum = 0
html_hdr = '<html><body style="font-family:Helvetica; background-color:black; color:palegreen; line-height:26px; text-align:left;">'
html_ftr = '</body></html>'

outfile = open(str(f_cnt) + '.html', 'w')
outfile.write(html_hdr)

for line in fh:
  if (sum < batch_size):
    outfile.write(line + '<br>')
    sum = sum + len(line)
  else:
    outfile.write(html_ftr)
    outfile.close()
    sum = 0
    f_cnt = f_cnt + 1
    outfile = open(str(f_cnt) + '.html', 'w')
    outfile.write(html_hdr)

outfile.write(html_ftr)

outfile.close()
fh.close()